package com.thread;
public class ThreadRunnable implements Runnable {

	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName());
	}
	
	public void start(){
		new Thread(this).start();
	}
	
	public static void main(String[] args){
		System.out.println(Thread.currentThread().getName());
		//启动线程的一种方式
		Thread t = new Thread(new ThreadRunnable(),"thread-000");
		t.start();
//		new ThreadRunnable().start();
		//判断线程t是否已经完全停止掉，如果没有，当前主线程将会休眠2s
		if(t.isAlive()){
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.println(t.isAlive() + "...............");
		}
		
	}

}
